package com.chen.common.util;

/**
 * @author ex_chenzy59
 * @since 2025/4/7
 */
public class MyBool {
    private boolean val;
    public static MyBool build(Boolean val){
        var result=new MyBool();
        result.val= val != null && val;
        return result;
    }
    public void val(boolean val){
        this.val=val;
    }
    public MyBool ifDo(Runnable action){
        if (val){
            action.run();
        }
        return this;
    }
    public MyBool elseDo(Runnable action){
        if (!val){
            action.run();
        }
        return this;
    }

    @Override
    public String toString() {
        return String.valueOf(val);
    }
}
